package week_4.homework;

import week_4.practice.ArrayList;
import week_4.practice.ArrayUnorderedList;
import week_4.practice.ProgramOfStudy;
//pp6.17修改本章的Course类，是之实现Comparable接口。首先按系排序课程，再按课程号排序。
public class POSTester1 {
    public static void main(String[] args) {
        //具体的课程。
        Course1 course1=new Course1("CS",101,"Introduction to Programming","A-");
        Course1 course2=new Course1("ARCH",305,"Building Analysis","A");
        Course1 course3=new Course1("GER",210,"Intermediate German");
        Course1 course4=new Course1("CS",320,"Computer Architecture");
        Course1 course5=new Course1("THE",201,"The Theatre Experience");

        ArrayUnorderedList list = new ArrayUnorderedList();
        list.addToRear(course1);
        list.addToRear(course2);
        list.addToRear(course3);
        list.addToRear(course4);
        list.addToRear(course5);

        System.out.println("当前的列表为：");
        System.out.println(list.toString());
        System.out.println("进行排序");
        System.out.println("将第一位和第二位进行比较"+ " "+course1.compareTo(course2));
        if(course1.compareTo(course2)==1) {
            System.out.println("course1:" + course1);
            System.out.println("course2:" + course2);
        }
        else
        {
            System.out.println("course1:" + course2);
            System.out.println("course2:" + course1);
        }
        System.out.println("将第三位和第四位进行比较"+ " "+course3.compareTo(course4));
        if(course3.compareTo(course4)==1) {
            System.out.println("course3:" + course3);
            System.out.println("course4:" + course4);
        }
        else
        {
            System.out.println("course1:" + course3);
            System.out.println("course2:" + course4);
        }





    }
}
